package com.itic.system.spu.category.service;

import com.itic.appbase.framework.common.constants.DBConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.itic.appbase.framework.common.service.CrudService;
import com.itic.system.spu.category.persistence.dao.SpuCategoryDao;
import com.itic.system.spu.category.persistence.model.SpuCategory;
import com.itic.system.spu.category.persistence.model.SpuCategoryExample;
import com.itic.system.spu.category.persistence.model.SpuCategoryExample.Criteria;

import java.util.List;


@Service
@Transactional
public class SpuCategoryService
     extends CrudService<SpuCategoryDao,SpuCategory,SpuCategoryExample> {
    @Autowired
    private SpuCategoryDao spuCategoryDao;

    /**
     * 查询所有的商品
     * @return
     */
    public List<SpuCategory> findSpuCategory(){
        SpuCategoryExample example = new SpuCategoryExample();
        Criteria criteria = example.createCriteria();
        criteria.andIsEffectiveEqualTo(DBConst.TRUE);
        List<SpuCategory> spuCategories = this.list(example);
        return spuCategories;
    }
}